package com.manor.paradise.adapter

import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.manor.common.utils.content
import com.manor.common.utils.front
import com.manor.common.utils.scaleDown
import com.manor.paradise.R
import com.manor.paradise.bean.CrystalBean
import com.manor.paradise.bean.OresBean
import com.manor.paradise.bean.RecordSBean
import kotlinx.android.synthetic.main.lyb_item_my_active.view.*

/*class LybMiAdapter(data: ArrayList<CrystalBean.RecordsBean>?,  val type: Int = 0) : BaseQuickAdapter<CrystalBean.RecordsBean, BaseViewHolder>(R.layout.lyb_item_my_active, data) {
    override fun convert(helper: BaseViewHolder, item: CrystalBean.RecordsBean) {

        if(item.transType==1){
            helper.itemView.sActiveTagIv.setImageResource(R.drawable.up_green)
            helper.itemView.sActiveDetailsCountTv.text = item.crystal.front("+")
        }else{
            helper.itemView.sActiveDetailsCountTv.text = item.crystal.front("-")
            helper.itemView.sActiveTagIv.setImageResource(R.drawable.down_gray)
        }
        helper.itemView.sActiveDetailsNameTv.text = item.content
        helper.itemView.sActiveTimeTv.text = item.createTime
    }
}*/

class LybMiAdapter(data: ArrayList<OresBean.RecordsBean>) : BaseQuickAdapter<OresBean.RecordsBean, BaseViewHolder>(R.layout.lyb_item_my_active, data) {
    override fun convert(holder: BaseViewHolder, item: OresBean.RecordsBean) {
        if(item.transType==1){
            holder.itemView.sActiveTagIv.setImageResource(R.drawable.up_green)
            holder.itemView.sActiveDetailsCountTv.content("+" + item.crystalOre)
        }else{
            holder.itemView.sActiveDetailsCountTv.content("-" + item.crystalOre)
            holder.itemView.sActiveTagIv.setImageResource(R.drawable.down_gray)
        }
        holder.itemView.sActiveDetailsNameTv.text = item.content
        holder.itemView.sActiveTimeTv.text = item.createTime
    }
}

class LybMkAdapter(data: ArrayList<RecordSBean>) : BaseQuickAdapter<RecordSBean, BaseViewHolder>(R.layout.lyb_item_my_active, data) {
    override fun convert(holder: BaseViewHolder, item: RecordSBean) {
        if(item.payType==1){
            holder.itemView.sActiveTagIv.setImageResource(R.drawable.up_green)
            holder.itemView.sActiveDetailsCountTv.content("+" + item.starPoint.scaleDown(4))

        }else{
            holder.itemView.sActiveDetailsCountTv.content("-" + item.starPoint.scaleDown(4))
            holder.itemView.sActiveTagIv.setImageResource(R.drawable.down_gray)
        }
        holder.itemView.sActiveDetailsNameTv.text = item.content
        holder.itemView.sActiveTimeTv.text = item.createTime
    }
}

class LybPowerAdapter(data: MutableList<CrystalBean.RecordsBean>?) : BaseQuickAdapter<CrystalBean.RecordsBean, BaseViewHolder>(R.layout.lyb_item_my_active, data) {
    override fun convert(holder: BaseViewHolder, item: CrystalBean.RecordsBean) {
        if(item.transType==1){
            holder.itemView.sActiveTagIv.setImageResource(R.drawable.up_green)
            holder.itemView.sActiveDetailsCountTv.content("+" +item.crystal)

        }else{
            holder.itemView.sActiveDetailsCountTv.content("-" +item.crystal)
            holder.itemView.sActiveTagIv.setImageResource(R.drawable.down_gray)
        }
        holder.itemView.sActiveDetailsNameTv.text = item.content
        holder.itemView.sActiveTimeTv.text = item.createTime
    }
}